package com.huike.clues.service.impl;


import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.mapper.TbClueMapper;
import com.huike.clues.mapper.TbClueTrackRecordMapper;
import com.huike.clues.service.ITbClueTrackRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 线索跟进记录Service业务层处理
 * @date 2022-04-22
 */
@Service
public class TbClueTrackRecordServiceImpl implements ITbClueTrackRecordService {

    @Autowired
    private TbClueMapper tbClueMapper;

    @Autowired
    private TbClueTrackRecordMapper tbClueTrackRecordMapper;


    /**
     * 新增线索跟进记录
     * @param clueTrackRecord  新增线索跟进记录 到线索记录表中
     * @param tbClue  需要更新的线索
     * @return
     */
    @Override
    @Transactional
    public int addTbClueTrackRecord(TbClueTrackRecord clueTrackRecord, TbClue tbClue) {
        //更新线索基本属性
        tbClueMapper.updateTbClue(tbClue);
        return tbClueTrackRecordMapper.insertTbClueTrackRecord(clueTrackRecord);
    }

    /**
     * 查询线索跟进记录列表
     */
    @Override
    public List<TbClueTrackRecord> selectList(Long clueId) {
        List<TbClueTrackRecord> list = tbClueTrackRecordMapper.selectList(clueId);
        return list;
    }
}
